package com.ymatou.iapi.sellerproduct.service;

import java.util.Map;

import org.json.JSONObject;

import com.ymt.core.tool.Logger;
import com.ymttest.business.YmatouAutoTestCall;
import com.ymttest.utils.EnvSetup;
import com.ymttest.utils.YMTDateUtil;
/**
*商品取消置顶Call
*FreeMaker Template自动生成代码
*/
public class CancelRecommendCall extends YmatouAutoTestCall{
	private static String opurl ="/api/SellerProduct/CancelRecommend";
	
	public CancelRecommendCall() {
		super(EnvSetup.getSystemUrl("sellerproduct_iapi"),opurl,"POST","JSON");
	}
	@Override
	public void addDefHeader() {
		client.addHeader("Accept","text/xml,text/javascript,text/html,application/json");
		client.addHeader("Content-Type", "application/json; charset=UTF-8");
	}
	
//	/**
//	 * CALL CancelRecommend
//	 * @param param 请求参数
//	 * @return 返回报文
//	 * @throws Exception
//	 */
//	public static String  cancelrecommendcall(Map calldate) throws Exception {
//	    try {	    	
//	    	//调用接口json文件
//	    	CancelRecommendCall cancelRecommendCall = new CancelRecommendCall();
//			JSONObject cancelrecommendBean =  JsonBeanHelper.getJsonBean(JsonBeanFile.SetRecommendTpl);
//			cancelrecommendBean = JsonBeanHelper.updateJsonBean(cancelrecommendBean, calldate);				
//			cancelRecommendCall.setData(cancelrecommendBean);
//			cancelRecommendCall.callService();
//			String result = cancelRecommendCall.getReturnData();
//			return result;
//	    }catch (Exception e) {  
//	        e.printStackTrace();	        
//	    }  
//	    return null;
//	}
	
	/**
	 * CALL CancelRecommend
	 * @param param 请求参数
	 * @return 返回报文
	 * @throws Exception
	 */
	public static JSONObject  cancelrecommendcall(Map calldate) throws Exception {
	    try {	    	
	    	//调用接口json文件
	    	YMTDateUtil.waitTime(1);
	    	CancelRecommendCall cancelRecommendCall = new CancelRecommendCall();
	    	JSONObject result = cancelRecommendCall.callAndGetReturnData(calldate);
			return result;
	    }catch (Exception e) {  
	        e.printStackTrace();	        
	    }  
	    return null;
	}

	/**
	 * 返回信息公用错误信息部分断言（正向Case场景）
	 * @param dataStr 传入报文信息
	 * @throws Exception 错误信息
	 */
	public static void cancelrecommendGetreturncode(JSONObject dataStr) throws Exception {
	    try {	    	
			//返回报文断言		
			String code =  dataStr.getString("Code");
			Logger.verifyIsContains(200, code, "\"Code\":200");
			String msg =  dataStr.getString("Msg");
			Logger.verifyIsNull(msg, "Msg等于空");			
			String Success =  dataStr.getJSONObject("Data").getString("Success");
			Logger.verifyIsContains(true, Success, "\"Success\":true");
			String trace =  dataStr.getString("Trace");
			Logger.verifyIsNull(trace, "Trace等于空");
	    	    	    	
	    }catch (Exception e) {  
	        e.printStackTrace();
	    }  
	}

	/**
	 * 错误信息断言
	 * @param dataStr 传入报文信息
	 * @param scode 错误代码
	 * @param sBcode 业务代码
	 * @param sMsg 错误信息
	 * @throws Exception
	 */
	public static void cancelrecommendGetreturnerrcode(JSONObject dataStr,int scode,int sBcode,String sMsg) throws Exception {
	    try {
			//返回报文断言	
			String code =  dataStr.getString("Code");
			Logger.verifyIsContains(scode, code, "\"Code\":201");
			String bCode =  dataStr.getString("BCode");
			Logger.verifyIsContains(sBcode, bCode, "\"BCode\":0");
			/*String msg =  dataStr.getString("Msg");
			Logger.verifyIsContains(sMsg, msg, "\"BCode\":0");		*/
			String data =  dataStr.getString("Data");
			Logger.verifyIsNull(data, "Data等于空");
			String trace =  dataStr.getString("Trace");
			Logger.verifyIsNull(trace, "Trace等于空");			
	    		    	    	    	
	    }catch (Exception e) {  
	        e.printStackTrace();
	    }  
	}	


}